﻿//-----------------------------------------------------------------------
// <copyright file="ProjectStatusUtils.cs" company="Microsoft Corporation">
//     Copyright Microsoft Corporation. All Rights Reserved. This code released under the terms of the Microsoft Public License (MS-PL, http://opensource.org/licenses/ms-pl.html.) This is sample code only, do not use in production environments.
// </copyright>
//-----------------------------------------------------------------------

namespace vsarFlightPlan.Utilities
{
    using vsarFlightPlan.ViewModels;

    /// <summary>
    ///
    /// </summary>
    public static class ProjectStatusUtils
    {
        /// <summary>
        /// To the project status.
        /// </summary>
        /// <param name="s">The s.</param>
        /// <returns></returns>
        public static ProjectStatus ToProjectStatus(this string s)
        {
            if (string.IsNullOrWhiteSpace(s))
            {
                return ProjectStatus.Idea;
            }

            switch (s.ToUpperInvariant())
            {
                case "IDEA":
                    {
                        return ProjectStatus.Idea;
                    }
                case "TAKEOFF":
                case "FLYING":
                case "LANDING":
                case "INFLIGHT":
                    {
                        return ProjectStatus.InFlight;
                    }
                case "LANDED":
                    {
                        return ProjectStatus.Landed;
                    }
                case "CANCELLED":
                    {
                        return ProjectStatus.Cancelled;
                    }
                case "PROBLEM":
                case "DELAYED":
                    {
                        return ProjectStatus.Delayed;
                    }
            }

            return ProjectStatus.Idea;
        }
    }
}